<?php

include '../php-ofc-library/open-flash-chart.php';

$title = new title( 'Chart 3: XXX' );
$title->set_style('{font-size: 20px; color:#000000; font-family: Verdana; text-align: center}');


srand((double)microtime()*1000000);
$data = array();
$d1=rand(0,10);
$data[] = new pie_value($d1, "Alive");
$data[] = new pie_value(10-$d1, "Dead");

$pie = new pie();
$pie->set_tooltip( '#label#' );
$pie->set_no_labels();
$pie->set_colours(
    array(
        '#77CC6D',//green
        '#FF5973',//pink
    ) );
$pie->set_values( $data );
//$pie->set_gradient_fill();
$pie->radius(100);


srand((double)microtime()*1000000);
$data2 = array();
$t1=rand(0,1);
$t2=$d1==1?0:1;
$data2[] = new pie_value($t1, "Alive");
$data2[] = new pie_value($t2, "Dead");

$pie2 = new pie();
$pie2->set_tooltip( '#label#' );
$pie2->set_no_labels();
$pie2->set_colours(
    array(
        '#77CC6D',//green
        '#C95653',//pink
    ) );
$pie2->set_values( $data2 );

$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->set_bg_colour( '#FFFFFF' );
$chart->add_element( $pie );
//$chart->add_element( $pie2 );

echo $chart->toPrettyString();
?>
